<script>window.channelTopicId = "<%= @topic.id %>"</script>
<div class="row">
  <div class="col-md-9">
    <div class="topic-detail card">
      <div class="card-header media clearfix">
        <div class="media-body">
          <h1 class="media-heading">
            <a class="node" href="/topics?node_id=<%= @topic.node_id %>">
              <%= @topic.node.name %>
            </a>
            <span class="title"><%= @topic.title %></span>
          </h1>
          <div class="info">
            <%= link @topic.user.username, to: user_path(@conn, :show, @topic.user.username) %>
            <%= time_tag(@topic.inserted_at) %>
            <%= if @topic.reply_count != 0 do %>
              <span class="hidden-mobile">
                • <%= gettext "Last by" %>
                <%= link @topic.last_reply_user.username, to: user_path(@conn, :show, @topic.last_reply_user.username), class: "user-name" %>
                <%= gettext "replied at" %> <%= time_tag(@topic.updated_at) %>
                <%= time_tag(@topic.updated_at) %>
              </span>
            <% end %>
            ·
            <%= @topic.visit_count %> <%= gettext "hits" %>
          </div>
        </div>
        <div class="avatar media-right">
          <%= link to: user_path(@conn, :show, @topic.user.username), title: @topic.user.username do %>
            <img class="media-object avatar-48" src="<%= qn_url(@topic.user.avatar) %>" />
          <% end %>
        </div>
      </div>

      <%= if @topic.type == :featured do %>
        <div class="label-awesome">
          <i class="fa fa-diamond awesome"></i>
          本帖已被设为精华帖！
        </div>
      <% end %>

      <div class="card-body markdown markdown-toc">
        <%= markdown(@topic.body) %>
      </div>

      <div class="card-footer clearfix">
        <%= render "_operate_toolbar.html", assigns %>
      </div>
    </div>

    <%= render "_replies.html", assigns %>
    <%= render "_handle_reply.html", assigns %>
    <%#= render "_relation_topic.html", assigns %>
  </div>

  <div class="sidebar hidden-mobile col-md-3">
    <%= render "_right_sidebar.html", assigns %>
  </div>
</div>